package com.dofuntech.dataplatform.protocal;

import com.dofuntech.dataplatform.util.ByteEncoder;

import org.apache.mina.core.buffer.IoBuffer;

import java.io.IOException;

/**
 * δ֪��Ϣ��
 * <p>
 *
 * @author DavidChen
 */
public class UnknownBody extends MessageBody<UnknownBody> {

    private String unknown;

    UnknownBody() {

    }

    @Override
    public Command command() {
        return Command.UNKNOWN;
    }

    @Override
    public void writeTo(IoBuffer encoder) throws IOException {
        // ����Ĭ�ϲ���ʵ�֣���Ϊ���ͷ������ܷ���һ��unknown����Ϣ
    }

    @Override
    public UnknownBody decode(byte[] buffer, int offset, int byteCount) {
        this.unknown = ByteEncoder.readString(buffer, offset, byteCount);
        return this;
    }

    @Override
    public String toString() {
        return "-δ֪����-,��Ϣ����" + getContentLength();
    }

    public String getUnknown() {
        return this.unknown;
    }
}
